package cn.zyy.controller;

import cn.zyy.entity.Student;
import cn.zyy.service.ScoreService;
import cn.zyy.service.ScoreServiceImpl;

import java.util.ArrayList;
import java.util.Map;

/**
 * 成绩控制层
 */
public class ScoreController {
    private ScoreService scoreService = new ScoreServiceImpl();
    //根据学生姓名和科目名称给学生记录成绩
    public Map<String,Integer> addScore(String stuName, String courseName) {
        return scoreService.addScore(stuName,courseName);
    }
    public boolean isAddScore(int stuId, int courseId) {
        return scoreService.isAddScore(stuId,courseId);
    }
    public Boolean addScore(int stuId, int courseId, double score, boolean isAddScore) {
        return scoreService.addScore(stuId,courseId,score,isAddScore);
    }
    //根据科目名称查询所有学生的成绩，并降序排列
    public int selectScore(String courseName) {
        return scoreService.selectScore(courseName);
    }
    public ArrayList<Student> selectScore(int courseId) {
        return scoreService.selectScore(courseId);
    }

}
